package com.woniu.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class StartTestMQConfig {
    private static final String START_TEST_QUEUE_NAME = "sendFlagQueue";
    private static final String START_TEST_EXCHANGE_NAME = "sendFlagExchange";
    private static final String START_TEST_ROUTING_KEY = "sendFlag";
    @Bean
    public Queue sendFlagQueue(){
        return QueueBuilder.durable(START_TEST_QUEUE_NAME)
                .build();
    }
    @Bean
    public DirectExchange sendFlagExchange(){
        return new DirectExchange(START_TEST_EXCHANGE_NAME);
    }


    @Bean
    public Binding sendFlagBinding(){
        return BindingBuilder.bind(sendFlagQueue())
                .to(sendFlagExchange())
                .with(START_TEST_ROUTING_KEY);
    }

}
